function showPopup(url, title)
{
	var features = 'resizable=no,scrollbars=no,status=no,width=320,height=200,left=50%,top=50%,centerscreen=yes,dialog=yes';
	window.open(url, title, features);	
}

function replaceUrls(input)
{
	return input
		// replace youtube by temporary placeholder
		.replace(/((http|ftp)\:\/\/)?([w]{3}\.)?(youtube\.)([a-z]{2,4})(\/watch\?v=)([a-zA-Z0-9_-]+)(\&feature=)?([a-zA-Z0-9_-]+)?/,
			'youtube/$7')
		// replace vimeo by temporary placeholder
		.replace(/((http|ftp)\:\/\/)?([w]{3}\.)?(vimeo\.)([a-z]{2,4})(\/)([0-9]+)/,
			'vimeo/$7')
		// replace URLs with links
		.replace(/(\b|^)(ftp|http|https):\/\/[\S]+(\b|$)/gim,
			'<a href="$&" class="link" target="_blank">$&</a>')
		// replace WWWs with links
		.replace(/([^\/])(www[\S]+(\b|$))/gim,
			'$1<a href="http://$2" class="link" target="_blank">$2</a>')
		// replace youtube placeholder with embed
		.replace(/youtube\/([a-zA-Z0-9_-]+)/,
			'<iframe width="420" height="345" src="http://www.youtube.com/embed/$1" frameborder="0" allowfullscreen></iframe>')
		// replace vimeo placeholder with embed
		.replace(/vimeo\/([a-zA-Z0-9_-]+)/,
			'<iframe src="http://player.vimeo.com/video/$1?title=0&amp;byline=0&amp;portrait=0" width="400" height="225" frameborder="0" webkitAllowFullScreen allowFullScreen></iframe>');
}
